import 'package:flutter/material.dart';
import 'package:aweb5/base/BaseWidget.dart';

class ShoppingCart extends BaseWidget {
  @override
  State<ShoppingCart> createState() => ShoppingCartState();
}

class ShoppingCartState extends BaseWidgetState<ShoppingCart> {
  bool check=false;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.white,
          title: Text(
            "购物车",
            style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
          ),
          centerTitle: true,
          elevation: 0,
        ),




      bottomSheet: bottomSheet(),

    );
  }

  Widget bottomSheet(){
    return
      Container(
        height: 40.0,
        padding: EdgeInsets.only(left: 10.0, right: 10.0),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            Checkbox(
                value: check,
                onChanged: (check) {
                  this.check=check;
//                  total = 0;
//                  this.check = check;
//                  for (Shop shop in list) {
//                    shop.check = check;
//                  }
//                  for (Shop shop in list) {
//                    if (shop.check) {
//                      total = total + shop.price;
//                    }
//                  }
                  setState(() {});
                }),
            Expanded(
              child: Text(""),
            ),
            Text("合计"),
            Text(
              "¥1",
              style: TextStyle(color: Colors.red),
            ),
            Container(
                padding: EdgeInsets.all(5.0),
                decoration: BoxDecoration(
                    color: Colors.red,
                    borderRadius: BorderRadius.circular(10.0)),
                child: Text(
                  "结算",
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 19.0,
                  ),
                )),
          ],
        ),
      );


  }


}